<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
    <link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/tips.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/js/web/consultant_client_tracking_list.js?1.0"></script>
<script src="${staticServer}/js/web/system_reception_list.js?1.2"></script>
<script>
var contextPath='${contextPath}';

$(function(){
});

function extracted() {
}


$(function(){
	//全选按钮 
	$("#allChecked").click(function(){
		if($(this).is(':checked')==true){
			$("#datas td input[type=checkbox]").prop("checked","true");
		}else{
			$("#datas td input[type=checkbox]").prop("checked",false);
		}
	});

});

var updateClient = function(){
	var $obj = $("#datas td input[type=checkbox]:checked");
	if($obj.length == 0){
		alert("请至少选择一条记录");
		return ;
	}
	if(confirm("确定标记？标记后无法恢复。")){
		var ids = '';
		for(var i = 0;i<$obj.length;i++){
			if(i == $obj.length-1){
				ids += $($obj[i]).val();
			}else{
				ids += $($obj[i]).val()+",";
			}
		}
		var url = "${contextPath}/consu/consultant_update.json";
    	$.post(url, {"ids":ids}, 
			function(ms) {
	 			if(ms.msg != null){
	 				if(ms.msg == "0"){
	 					alert("不是自己的资源，无法标记！");
	 				}else if(ms.msg == "1"){
	 					alert("标记成功!");
	 					setTimeout(function(){
	 						location.reload(); 
						},1200);
	 				}else if(ms.msg == "2"){
	 					alert("已分配资源不可标记!");
	 				}
	 				
	 			}else{
	 				alert("抱歉，系统忙");
	 			}
    	});
    };
}

var czhi = function(){
	$("#type").val("");
	$("#state").val("");
	$("#color").val("");
	$("#st_type").val("");
	$("#lianxi_name").val("");
	$("#phone").val("");
	window.location.href="${contextPath}/index/dhzy_phone_list.htm?haiQx=${haiQx}";
}

function state(stat){
	window.location.href="${contextPath}/index/dhzy_phone_list.htm?stat="+stat+"&haiQx=${haiQx}";
}

function submit(){
	window.location.href="${contextPath}/index/dhzy_phone.htm?phone="+$("#phone").val()+"&stardate="+$("#stardate").val()+"&enddate="+$("#enddate").val();
}

function add(){
	window.location.href="${contextPath}/index/dhzy_phone_add.htm";
}
function update2(){
	window.location.href="${contextPath}/index/dhzy_phone_add.htm";
}
</script>
</head>

<body>
<input type="hidden" id="traId" value="">
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>资源统计</li>
			<li>&gt;</li>
			<li class="current">400电话资源</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table class="form_table">
			<tr>
				<td>
					<div style="overflow: hidden;">
						<label><b>查询条件：客户电话</b></label>
						<input type="text" id="phone" size="20" value="" />
						<input style="margin-left:70px;" type="text" id="stardate" size="20" rel="DATE::Y-m-d" value="${stardate}" readonly="readonly" class="DatePicker_Icon">
						<input type="text" id="enddate" size="20" rel="DATE::Y-m-d" value="${enddate}" readonly="readonly" class="DatePicker_Icon">
						<input type="button" value=" 查 询 " onclick="submit()" />
						<#if webutil.getCookieUser().usergroup!=9>
							<input title="清理自己填写或上传的错误数据" type="button" value=" 删除 " onclick="deleteClient()" />
						</#if>
						<input type="button" value=" 重置 " onclick="czhi()" />
						<input type="button" value=" 录入400电话  " onclick="add()" />
					</div>
				</td>
			</tr>
		</table>
		<table>
			<tr class="fields">
				
				<th>登记老师</th>
				<th>客户姓名</th>
				<th>城市</th>
				<th>预留手机号</th>
				<th>接听中心</th>
				<th>预约状态</th>
				<th>未预约原因</th>
				<th>上传日期</th>
			</tr>
			<tbody id="datas">
			<#if list??>
				<#list list as list>
					<tr class="even_row" >
						<td align="center">${list.username}</td>
						<td align="center">${list.nickname}</td>
						<td align="center">${list.city}</td>
						<td align="center">${list.phone}</td>
						<td align="center">${list.region}</td>
						<td align="center">
							<#if list.states?exists>
	                       <#if list.states=="qenzgu6wde3c">明确不参加</#if>
	                       <#if list.states=="nhb8wyq1nda5">有较高意向和兴趣</#if>
	                       <#if list.states=="qyebkhp2x67y">已经发送相关协议</#if>
	                       <#if list.states=="138g5wfwm1mx">计划另行跟踪</#if>
	                       <#if list.states=="mldqhlrg1sad">已成功预约测评</#if>
	                       <#if list.states=="n4f79h2giie6">意向一般</#if>
	                    	</#if>
						</td>
						<td title="${list.remark}" contenteditable="true" align="center">
						<#if (list.remark?length > 20)>${list.remark?substring(0,15)}...<#else>
						${list.remark}</#if></td>
						<td align="center">${list.cdatee}</td>
	            	</tr>
	            </#list>
			</#if>
			</tbody>
		</table>
	</div>
	<div id="page" style="width: 820px;">
	<ul id="pagination">
	<#if page??>
	<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
	<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
	<#if currpage==1 >
		<li class="previous-off">上一页</li>
		<#else>
		<li class="previous"><a href="${contextPath}/index/dhzy_phone.htm?currPage=${currpage-1}&stardate=${stardate}&enddate=${enddate}">上一页</a></li>
		</#if>
		
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/dhzy_phone.htm?currPage=${index_up}&stardate=${stardate}&enddate=${enddate}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/dhzy_phone.htm?currPage=${index_up}&stardate=${stardate}&enddate=${enddate}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/dhzy_phone.htm?currPage=${pagetotal}&stardate=${stardate}&enddate=${enddate}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/dhzy_phone.htm?currPage=1&stardate=${stardate}&enddate=${enddate}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/dhzy_phone.htm?currPage=${index_up}&stardate=${stardate}&enddate=${enddate}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/dhzy_phone.htm?currPage=${pagetotal}&stardate=${stardate}&enddate=${enddate}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/dhzy_phone.htm?currPage=1&stardate=${stardate}&enddate=${enddate}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/dhzy_phone.htm?currPage=${index_up}&stardate=${stardate}&enddate=${enddate}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/dhzy_phone.htm?currPage=${currpage+1}&stardate=${stardate}&enddate=${enddate}">下一页</a></li>
		</#if>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul></div>
	<div class="emptyline"></div>
</body>
</html>